package com.demo;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class ServletConfigDemo
 */
public class ServletConfigDemo extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		
		  ServletConfig servletConfig=   getServletConfig();
		
		
		PrintWriter  printWriter= response.getWriter();
		String dbName=servletConfig.getInitParameter("dbName");
		
		printWriter.print("<p>"+dbName+"</p>");
		printWriter.print("<p>"+dbName+"</p>");
		printWriter.print("<p>"+dbName+"+</p>");
		
		ServletContext servletContext=     getServletContext();
		 PrintWriter printWriter2=response.getWriter();
		 String DBName=servletContext.getInitParameter("DBName2");
		 printWriter2.print("<p>"+DBName+"</p>");
	
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
	}

}
